<?php

namespace app\rest\validate;

use think\Validate;

class User extends Validate
{
    // 定义规则
    protected $rule = [
        'name' => ['require', 'min' => 2, 'max' => 20],
        'sex' => ['in'=>'0,1,2'],
        'age' => ['number', 'between'=>'1,120'],
        'tel' => ['require', 'regex'=>'/^1[^012]\d{9}$/'],
    ];


    protected $message = [
        'name.require' => '咋滴? 你连名字都懒得写了????',
        'name.min' => '你也太短了把!!!',
        'age.number' => '你是不识数 还是咋地!!!',
    ];

}